Following is a demo of the task3.pl program.
?- initial_state(State), goal_0(Goal), plan(State, Goal, Steps).
State = [on(b1, table), on(b2, table), on(b3, table), on(b4, table), on(b5, table), on(b6, table), on(b7, table), on(b8, table)],
Goal = [on(b1, table), on(b2, b3), on(b3, b1), on(b4, b5), on(b5, b6), on(b6, table), on(b7, b4), on(b8, b7)],
Steps = [stack(b3, on(b1)), stack(b2, on(b3)), stack(b5, on(b6)), stack(b4, on(b5)), stack(b7, on(b4)), stack(b8, on(b7))] ;
State = [on(b1, table), on(b2, table), on(b3, table), on(b4, table), on(b5, table), on(b6, table), on(b7, table), on(b8, table)],
Goal = [on(b1, table), on(b2, b3), on(b3, b1), on(b4, b5), on(b5, b6), on(b6, table), on(b7, b4), on(b8, b7)],
Steps = [stack(b5, on(b6)), stack(b4, on(b5)), stack(b7, on(b4)), stack(b8, on(b7)), stack(b3, on(b1)), stack(b2, on(b3))] ;
false.
?- initial_state(State), goal_1(Goal), plan(State, Goal, Steps).
State = [on(b1, table), on(b2, table), on(b3, table), on(b4, table), on(b5, table), on(b6, table), on(b7, table), on(b8, table)],
Goal = [on(b2, table), on(b3, b2), on(b4, b3), on(b1, b4), on(b8, b7), on(b7, table), on(b6, b8), on(b5, b6)],
Steps = [stack(b3, on(b2)), stack(b4, on(b3)), stack(b1, on(b4)), stack(b8, on(b7)), stack(b6, on(b8)), stack(b5, on(b6))] ;
State = [on(b1, table), on(b2, table), on(b3, table), on(b4, table), on(b5, table), on(b6, table), on(b7, table), on(b8, table)],
Goal = [on(b2, table), on(b3, b2), on(b4, b3), on(b1, b4), on(b8, b7), on(b7, table), on(b6, b8), on(b5, b6)],
Steps = [stack(b8, on(b7)), stack(b6, on(b8)), stack(b5, on(b6)), stack(b3, on(b2)), stack(b4, on(b3)), stack(b1, on(b4))] ;
false.
?- initial_state(State), goal_2(Goal), plan(State, Goal, Steps).
State = [on(b1, table), on(b2, table), on(b3, table), on(b4, table), on(b5, table), on(b6, table), on(b7, table), on(b8, table)],
Goal = [on(b1, b3), on(b2, b4), on(b3, table), on(b4, table), on(b5, b1), on(b6, b5), on(b7, b8), on(b8, table)],
Steps = [stack(b1, on(b3)), stack(b5, on(b1)), stack(b6, on(b5)), stack(b2, on(b4)), stack(b7, on(b8))] ;
State = [on(b1, table), on(b2, table), on(b3, table), on(b4, table), on(b5, table), on(b6, table), on(b7, table), on(b8, table)],
Goal = [on(b1, b3), on(b2, b4), on(b3, table), on(b4, table), on(b5, b1), on(b6, b5), on(b7, b8), on(b8, table)],
Steps = [stack(b2, on(b4)), stack(b1, on(b3)), stack(b5, on(b1)), stack(b6, on(b5)), stack(b7, on(b8))] ;
State = [on(b1, table), on(b2, table), on(b3, table), on(b4, table), on(b5, table), on(b6, table), on(b7, table), on(b8, table)],
Goal = [on(b1, b3), on(b2, b4), on(b3, table), on(b4, table), on(b5, b1), on(b6, b5), on(b7, b8), on(b8, table)],
Steps = [stack(b7, on(b8)), stack(b1, on(b3)), stack(b5, on(b1)), stack(b6, on(b5)), stack(b2, on(b4))].